import axios from 'axios'
import Vuex from '@/store/index'

const request = axios.create({
  baseURL:"http://api-toutiao-web.itheima.net"
})

request.interceptors.request.use(config=>{
  if(Vuex.state.user){
    config.headers['Authorization'] = 'Bearer '+ Vuex.state.user.token
  }
  
  return config
})



export default request